module app {
    export class MainMenuMediator extends puremvc.Mediator implements puremvc.IMediator {
        public static NAME: string = "MainMediator";

        private menu: MainMenu = new MainMenu();

        constructor() {
            super(MainMenuMediator.NAME);
        }

        public show(): void {
            let bg = new eui.Image("bg_jpg");
            LayerManager.getInstance().loadSky(bg);
            
            LayerManager.getInstance().loadScene(this.menu);
            this.menu.once(egret.Event.COMPLETE, this.bindAction, this);
        }

        private bindAction(): void {
            this.menu.joinBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
                this.facade.sendNotification(Commands.JOIN_GAME);
            }, this);
        }
    }
}